<template>
  <div class="container">
    <div class="box">
      <div class="left">
        <p class="time">{{ time }}</p>
        <p class="name">{{ getTitle() }}</p>
      </div>
      <div class="content">
        <div class="content-inner">
          <LoginForm v-if="type == 0" @change="type = 1" />
          <forget v-else @change="type = 0" />
        </div>
      </div>
    </div>
    <Footer />
  </div>
</template>

<script lang="ts" setup>
import Footer from '@/layout/components/footer/index.vue'
import LoginForm from './components/login-form.vue'
import { getTitle } from '@/utils'
import forget from './components/forget.vue'
import moment from 'moment'
const type = ref(0)
const now = ref(new Date())
const timer = setInterval(() => {
  now.value = new Date()
}, 1000)
onUnmounted(() => clearInterval(timer))
const time = computed(() => {
  return moment(now.value).format('YYYY-MM-DD hh:mm:ss')
})
</script>

<style lang="less" scoped>
.container {
  display: flex;
  height: 100vh;
  .box {
    width: 1000px;
    margin: auto;
    display: flex;
    overflow: hidden;
    border-radius: 10px;
    height: 500px;
    box-shadow: -4px 5px 10px rgba(0, 0, 0, 0.4);
    .left {
      width: 50%;
      background: #8e9aaa;
      display: flex;
      padding: 10px;
      flex-direction: column;
      color: white;
      .name {
        margin: auto;
        text-align: center;
        font-size: 40px;
      }
    }
    .content {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 50%;
      .content-inner {
        margin: auto;
      }
    }
  }

  .footer {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 100%;
  }
}
</style>
